//
//  YLTool.m
//  YLTool
//
//  Created by EmberWei on 2018/7/30.
//  Copyright © 2018年 EmberWei. All rights reserved.
//

#import "YLTool.h"
#import "HTTPSTool.h"
#import "URLTool.h"

@implementation YLTool

/**
 * GET请求
 *  @param path URL地址路径
 *  @param params 参数
 *  @param success 成功回调
 *  @param failure 失败回调
 */

+ (void)GET:(NSString * _Nonnull)path
     params:(NSDictionary * _Nullable)params
    success:(Success _Nullable)success
    failure:(Failure _Nullable)failure{
    [HTTPSTool GETRequestWithPath:path params:params success:^(NSDictionary * _Nonnull JSON) {
        if (success)
            success(JSON);
    } failure:^(NSError * _Nonnull error) {
        if (failure)
            failure(ErrorStr);
    }];
}

/**
 * POST请求
 *  @param path URL地址路径
 *  @param params 参数
 *  @param success 成功回调
 *  @param failure 失败回调
 */

+ (void)POST:(NSString * _Nonnull)path
      params:(NSDictionary * _Nullable)params
     success:(Success _Nullable)success
     failure:(Failure _Nullable)failure {
    [HTTPSTool POST:path params:params cookie:nil success:^(NSDictionary * _Nonnull JSON) {
        if (success)
            success(JSON);
    } failure:^(NSError * _Nonnull error) {
        if (failure)
            failure(ErrorStr);
    }];
}

@end
